/**
 * <pre>
 * Copyright (C) 2015  Soulwolf XiaoDaoW3.0
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </pre>
 */
package com.example.administrator.baseadapter.recyclerview.holder;

import android.content.Context;
import android.content.res.Resources;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.IdRes;
import android.support.annotation.StringRes;
import android.text.TextWatcher;
import android.view.View;


public interface IViewHolder {


    /**
     * This view is visible.
     * Use with {@link #setVisibility} and <a href="#attr_android:visibility">{@code
     * android:visibility}.
     */
    public static final int VISIBLE = 0x00000000;

    /**
     * This view is invisible, but it still takes up space for layout purposes.
     * Use with {@link #setVisibility} and <a href="#attr_android:visibility">{@code
     * android:visibility}.
     */
    public static final int INVISIBLE = 0x00000004;

    /**
     * This view is invisible, and it doesn't take any space for layout
     * purposes. Use with {@link #setVisibility} and <a href="#attr_android:visibility">{@code
     * android:visibility}.
     */
    public static final int GONE = 0x00000008;

    View getConvertView();

    Context getContext();

    Resources getResources();

    <T extends View> T getView(int viewId);

    int getColor(@ColorRes int resId);

    String getString(@StringRes int resId);

    CharSequence getText(@IdRes int viewId);

    int getVisibility(@IdRes int viewId);


    IViewHolder setVisibility(@IdRes int viewId, int visibility);

    IViewHolder setEnabled(@IdRes int viewId, boolean enabled);

    IViewHolder setCheckBox(@IdRes int viewId, boolean checked);


    IViewHolder setText(@IdRes int viewId, @StringRes int resId);

    IViewHolder setText(@IdRes int viewId, CharSequence text);

    IViewHolder setTextColor(int viewId, @ColorInt int textColor);

    IViewHolder setTextColorRes(int viewId, @ColorRes int resId);

    IViewHolder setHint(@IdRes int viewId, @StringRes int resId);

    IViewHolder setHint(@IdRes int viewId, CharSequence text);


    IViewHolder setOnClickListener(int viewId, View.OnClickListener listener);

    IViewHolder setOnClickListener(int viewId, Object tag, View.OnClickListener listener);

    IViewHolder setOnTouchListener(int viewId, View.OnTouchListener listener);

    IViewHolder addTextChangedListener(int viewId, TextWatcher listener);


    IViewHolder setBackgroundResource(@IdRes int viewId, @DrawableRes int drawable);

    IViewHolder setImageResource(@IdRes int viewId, @DrawableRes int drawableId);


    IViewHolder display(Context context, int viewId, String url, @DrawableRes int shouldDrawable);

    IViewHolder recycle();

}
